/*
 * Created on Jun 29, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.vectrics.recruiter.job.event;

import java.util.Locale;

import org.vectrics.event.Event;
import org.vectrics.mail.EmailHtmlBase;
import org.vectrics.mail.MailMessage;
import org.vectrics.recruiter.job.Job;

/**
 * @author MMoore
 */
public class JobCreateEmailBuilder extends JobEmailBuilderBase {
	private Job job = null;
	
	/**
	 * 
	 */
	public JobCreateEmailBuilder(Event event, Job job, Locale locale) {
		super(event, job, locale);
		this.job = job;
	}
	
	
	public boolean supportsHtml() {
		return(true);
	}

	public MailMessage getTextMailMessage() {
		MailMessage message = new MailMessage(this.getDomain());
		message.setContentType(MailMessage.CONTENT_TEXT);
		message.setBody("This job was created: " + job.getTitle());
		message.setFromName(this.getEmailFromName());
		message.setSubject(this.getPhrase("email.subject.job.created"));
		return(message);
	}
	
	
	
	/* (non-Javadoc)
	 * @see org.vectrics.event.EventEmailBuilder#createHtmlEmail()
	 */
	protected EmailHtmlBase createHtmlEmail() {
		JobCreateHtmlEmail email = new JobCreateHtmlEmail(this.getLocale(), this.job);
		return(email);
	}

	
	public String getSubject() {
		String subject = this.getPhrase("email.subject.job.created") + ": "  + 
			this.getJob().getTitle() + " (" + this.getJob().getReferenceId() + ")";
		return(subject);
	}
}
